Flow analysis of lazy higher-order functional programs
نویسندگان
چکیده
In recent years much interest has been shown in a class of functional languages including HASKELL, lazy ML, SASL/KRC/MIRANDA, ALFL, ORWELL, and PONDER. It has been seen that their expressive power is great, programs are compact, and program manipulation and transformation is much easier than with imperative languages or more traditional applicative ones. Common characteristics: they are purely applicative, manipulate trees as data objects, use pattern matching both to determine control flow and to decompose compound data structures, and use a “lazy” evaluation strategy. In this paper we describe a technique for data flow analysis of programs in this class by safely approximating the behavior of a certain class of term rewriting systems. In particular we obtain “safe” descriptions of program inputs, outputs and intermediate results by regular sets of trees. Potential applications include optimization, strictness analysis and partial evaluation. The technique improves earlier work because of its applicability to programs with higher order functions, and with either eager or lazy evaluation. The technique addresses the call-by-name aspect of laziness, but not memoization. This paper extends [19] (a chapter in the out-of-print [2]) with proofs that the algorithm terminates and yields safe (i.e., sound or correct) approximations to program behavior. Relevance to this festschrift: John Reynolds’ 1969 and 1972 papers developed a related first-order program analysis framework [27], and inspired our method for handling higher-order functions [28].
منابع مشابه
Termination analysis of higher-order functional programs
This thesis concerns fully automatic termination analysis for higher-order purely functional programs, both strict and lazy. We build on existing work on size-change termination, in which a program is deemed to terminate if any potential infinite sequence of calls would result in infinite descent in a well-founded data value. This was proposed for strict firstorder programs, and a termination a...
متن کاملThe Unfolding Semantics of Functional Programs
The idea of using unfolding as a way of computing a program semantics has been applied successfully to logic programs and has shown itself a powerful tool that provides concrete, implementable results, as its outcome is actually source code. Thus, it can be used for characterizing not-so-declarative constructs inmostly declarative languages, or for static analysis. However, unfolding-based sema...
متن کاملThe Intensional Transformation for Functional Languages with User-Defined Data Types
We extend the intensional transformation [6, 4] so as to apply to first-order lazy functional languages with user-defined data types. Since higher-order functional programs can be translated to first-order ones with the use of data types [3], the proposed approach can also be used to transform fully higher-order lazy functional programs.
متن کاملHyperstrictness and the Parallel Evaluation of Lazy Functional Programs
Strictness analysis can be used for automatic parallelization of lazy functional programs while preserving their semantics (and termination properties, in particular). This paper considers ways of exploiting strictness analysis in implementing functional languages eeciently on stock parallel hardware. A strictness{based parallel evaluation model is presented, and is compared with the more gener...
متن کاملOptimizing Lazy Functional Programs Using Flow Inference
Nonstrict higher order functional programming languages are notorious for their low run time eeciency. Optimizations based on ow analysis, which determines for each variable x in a program which expressions could have originated the value of x, can improve the situation by removing redundant eval and thunk operations, avoiding thunk updates, and allowing the use of unboxed representations of so...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- Theor. Comput. Sci.
دوره 375 شماره
صفحات -
تاریخ انتشار 2007